package com.huage_10.lesson_02;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

public class ReflectTest01 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> array = new ArrayList<Integer>();

        Class<? extends ArrayList> c = array.getClass();
        Method add = c.getMethod("add", Object.class);
        add.invoke(array,"Hello");
        add.invoke(array,"World");

        System.out.println(array);

    }
}
